package com.example.serviceDriverUser.controller;


import com.example.internalcommon.dto.Car;
import com.example.internalcommon.dto.ResponseResult;
import com.example.internalcommon.response.TerminalResponse;
import com.example.serviceDriverUser.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lyra
 * @since 2023-04-12
 */
@RestController
public class CarController {

    @Autowired
    private CarService carService;

    /**
     * 29.添加终端
     * 在创建车辆时还应该添加车辆的轨迹
     * @param car
     * @return
     */
    @PostMapping("/car")
    public ResponseResult<TerminalResponse> addCar(@RequestBody Car car){
        return carService.addCar(car);
    }


    @GetMapping("/car")
    public ResponseResult<Car> getCarById(Long carId){
        return carService.getCarById(carId);
    }
}
